package IOTest;

import java.io.File;
import java.io.FileInputStream;

public class FIleInputStreamTest {
    public static void main(String[] args) {
        File file = new File("row.bin");
        if (file.exists()) {
            FileInputStream fis = null;
            Long filesize = 0L;
            try {
                fis = new FileInputStream(file);
                byte[] b = new byte[10240];
                int len;
                while ((len = fis.read(b)) != -1) {
                    for (int i = 0; i < len; i++) {
                        filesize++;
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                try {
                    fis.close();
                    System.out.println("文件大小：" + filesize + "字节");
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
